package kernel_gui.interfaces.kernel_gui;

import common.entities.persistent.User;

/**
 * @author Yoyo
 *
 */
public interface IManageUser {

	/**
	 * Creates a new user if user name isn't being used already and if the passwords match
	 * <br><br>
	 * <b>On Success</b> - will call gui's returnAnswer with Boolean value 'true'
	 * <br>
	 * <b>On fail</b> - will call gui's returnError with the right error message
	 * <br>
	 * @param userName
	 * @param password
	 * @param authPassword
	 */
	void createUser(String userName, String password, String authPassword, int requestId);
	
	/**
	 * Updates user
	 * <br><br>
	 * <b>On Success</b> - will call gui's returnAnswer with Boolean value 'true'
	 * <br>
	 * <b>On fail</b> - will call gui's returnError with the right error message
	 * <br>
	 * @param user - the user whose details will be updated
	 * @param newUserName - a string with the new user name or null if this field shouldn't be updated
	 * @param newPassword - a string with the new password or null if this field shouldn't be updated
	 * @param authNewPassword
	 */
	void updateUser(User user, String newUserName, String newPassword, String authNewPassword, int requestId);
	
	/**
	 * Deletes user
	 * <br><br>
	 * <b>On Success</b> - will call gui's returnAnswer with Boolean value 'true'
	 * <br>
	 * <b>On fail</b> - will call gui's returnError with the right error message
	 * <br>
	 * @param user - the user to be deleted
	 */
	void deleteUser(User user, int requestId);
	

	/**
	 * Counts how many user records in DB match wanted query
	 * <br><br>
	 * <b>On Success</b> - will call gui's returnAnswer with Integer value holding number of records
	 * <br>
	 * <b>On fail</b> - will call gui's returnError with the right error message
	 * <br>
	 * @param userNameSubStr
	 */
	void countUsers(String userNameSubStr, int requestId);
	
	/**
	 * Gets the set of users from DB that match wanted query ordered by user name
	 * <br><br>
	 * <b>On Success</b> - will call gui's returnAnswer with List<Users> that match wanted query (no matches is counted as success - empty list)
	 * <br>
	 * <b>On fail</b> - will call gui's returnError with the right error message
	 * <br>
	 * @param userNameSubStr
	 */
	void getUsers(String userNameSubStr,int from, int to, int requestId);
}
